from selenium import webdriver
from time import sleep
from selenium.webdriver import ChromeOptions

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as expected
from selenium.webdriver.support.wait import WebDriverWait


option = ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])
bro = webdriver.Chrome(executable_path='./chromedriver',options=option)
bro.get('www.baidu.com')

wait = WebDriverWait(bro, 10)   # 浏览器显示等待
wait.until(expected.visibility_of_element_located((By.ID, 'TANGRAM__PSP_4__userName')))    # 当用户名可见，再继续

userName_tag = bro.find_element_by_id('TANGRAM__PSP_4__userName')
password_tag = bro.find_element_by_id('TANGRAM__PSP_4__password')
userName_tag.send_keys('abcd@163.com')
sleep(1)
password_tag.send_keys('12345678')
sleep(1)